<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <link rel="stylesheet" href="../../layui/css/layui.css"  media="all">
</head>
<body>
    
   <div>
         <!--表单-->
         <form id="myform" class="layui-form" method="" action="" style="margin-top: 30px;">
           <input type="hidden" name="line_id">
           <!--员工姓名-->
           <div class="layui-form-item">
             <label class="layui-form-label" style="width: 120px">线路编号：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="line_number" lay-verify="required|line_number" autocomplete="off" class="layui-input">
             </div>
             <label class="layui-form-label" style="width: 120px">线路名称：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="line_name" lay-verify="required|line_name" autocomplete="off" class="layui-input">
             </div>
           </div>
           <!--出生日期、文化程度-->
           <div class="layui-form-item">

             <div class="layui-inline">
               <label class="layui-form-label"style="width: 120px">投运时间:</label>
               <div class="layui-input-inline" style="width: 250px">
                 <input type="text" name="line_date" id="date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
               </div>
             </div>

             <label class="layui-form-label" style="width: 120px">电压等级：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="line_rank" lay-verify="required|line_rank" autocomplete="off"  class="layui-input">
             </div>
           </div>


           <div class="layui-form-item">
             <label class="layui-form-label" style="width: 120px">线路长度：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="line_length" lay-verify="required|line_length" autocomplete="off"  class="layui-input">
             </div>
             <label class="layui-form-label" style="width: 120px">回路长度：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="line_backlength" lay-verify="required|line_backlength" autocomplete="off"class="layui-input">
             </div>
           </div>

           <div class="layui-form-item">
             <label class="layui-form-label" style="width: 120px">起始杆号：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="start_tower" lay-verify="required|start_tower" autocomplete="off"class="layui-input">
             </div>
             <label class="layui-form-label" style="width: 120px">终止杆号：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="stop_tower" lay-verify="required|stop_tower" autocomplete="off"class="layui-input">
             </div>
           </div>

           <div class="layui-form-item">
             <label class="layui-form-label" style="width: 120px">塔  基  数：</label>

             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="tower_number" lay-verify="required|tower_number" autocomplete="off" class="layui-input">
             </div>

             <label class="layui-form-label" style="width: 120px">是否启用：</label>
             <div class="layui-input-inline" style="width: 250px">
               <input type="text" name="state_name" lay-verify="required|state_name" autocomplete="off" class="layui-input">
             </div>
           </div>

           <!--备注-->
           <div class="layui-form-item layui-form-text" style="margin-left: 12px">
             <label class="layui-form-label">备注：</label>
             <div class="layui-input-block">
               <textarea  class="layui-textarea"  name="line_notes" style="width: 270px"></textarea>
             </div>
           </div>

           <!--提交按钮-->
           <div class="layui-form-item" style="padding-left: 500px; margin-top:-200px;padding-top: -500px;">
             <div class="layui-input-block">
               <button type="button" class="layui-btn" lay-filter="edit_line" lay-submit="edit_line" style="margin-left: -60px;">修改</button>
               <button type="button" class="layui-btn layui-btn-normal" id="quit"style="margin-left: 60px">取消</button>
             </div>
           </div>
         </form>
       </div>
       <!--第二个-->
   </div>
</body>

<script type="text/javascript" src="../../js/jquery-3.4.1.js"></script>
<!--引入本地layui.js-->
<script src="../../layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;
        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });

        //监听提交
        form.on('submit(edit_line)', function(data){
            $.ajax({
                url:"/modifiesLine.do",
                type:"post",
                data:JSON.stringify(data.field),
                dataType:"json",
                success:function (result) {
                    if (result.code == 200){
                        layer.msg("编辑成功,3秒后关闭当前以页...",{icon:1,time:3000,shade:0.4},function() {
                            parent.layer.close(parent.layer.index);
                        });


                    }else if (result.code == 500){
                        alert(result.message);
                    }else if (result.code == 405){
                        layer.msg(result.msg,{icon:5});
                    }
                }
            });
            return false;
        });

    });
</script>
<script>
    //取消线路编辑
    $(document).on('click',"#quit",function () {
        parent.layer.close(parent.layer.index);
    });
</script>
</html>